﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Zzcore.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BaseController : ControllerBase
    {
        protected readonly IFreeSql _fsql;
        public BaseController(IFreeSql fsql) {
            this._fsql = fsql;
        }

        [NonAction]
        protected Dictionary<string, Object> RenderJson(string status = "success", string message = "成功", int code = 0, Object data = null) {
            Dictionary<string, Object> result = new Dictionary<string, object>();
            result.Add("status", status);
            result.Add("message", message);
            result.Add("code", code);
            result.Add("data", data);
            return result;
        }
    }
}
